package com.itheima.day06.ZuoYe.ZuoYe3;

public final class ZuoYe3 {
    private ZuoYe3() {}
    public static final int find(double[] arr,double key)
    {
        int start = 0;
        int end = arr.length-1;
        int mid = (start+end)/2;
        for (int i = 0; i < arr.length; i++) {
            if(key == arr[mid]){
                return mid;
            }else if(key>arr[mid]){
                start = mid+1;
            }else{
                end = mid-1;
            }
        }
        return -1;
    }
    public static final void res(int result){
        if(result == -1){
            System.out.println("没有找到");
        }else{
            System.out.println("找到，索引为："+result);
        }
    }
}
